% Used with tipper calculations
% Find target line for band averaging tipper 
% tr. functions
% LIMITED USE

%latest date 18.10.2002

function[TLine,TRad] = SetLine(frq,TFreq,TRad),

flag = 1;
k = length(TFreq);
p = length(frq);
for i =1:k,
   j = 0;
   while flag == 1,
      j = j+1;
      if TFreq(i) == frq(j),
         flag = 0;
      elseif TFreq(i) < frq(j) & TFreq(i) > frq(j+1),
         flag = 0;
         elseif TFreq(i) > frq(j) & TFreq(i) < frq(j+1),
         flag = 0;
      elseif j >= (p-1),
         flag = 2;
      end;
   end;
   if flag == 0,
         TLine(i) = j;
         flag = 1;
         if TRad(i) + j > p,
            TRad(i) = p-j;
         end;
         if j-TRad(i) < 0,
            TRad(i) = j;
            end;
         
   else,
         TLine(i) = 0;
         flag = 1;
   end;
      
 end;    
            
  
   